for (var i = 0; i < document.getElementsByTagName('a').length; i++) {

    document.getElementsByTagName('a')[i].target = "_self";
}